﻿using System;
using Web.Extensions;
using Web.Pages;

namespace Web.CustomControls
{
    public partial class UserGrid : System.Web.UI.UserControl
    {
        #region Public Properties
        
        public string Url { get; set; }

        public string Height { get; set; }

        public bool LoadOnInitialization { get; set; }

        public string Filter { get; set; }

        public string OnSelectedRow { get; set; }

        public int MaxSelectedRows { get; set; }

        public string Title { get; set; }

        public bool ShowActionColumns { get; set; }

        public bool UseSimpleSearch { get; set; }

        #endregion

        #region Events

        protected void Page_Load(object sender, EventArgs e)
        {
            // base.Page_Load(sender, e);

            if (!Page.IsPostBack)
            {
                this.CargarPagina();
            }
        }

        #endregion

        #region Private Methods

        private void CargarPagina()
        {
            var tiposUsuario = BasePage.TiposUsuario.ObtenerTodos();
            this.selUserGrid_Search_UsuarioTipo.Bind(tiposUsuario, "Id", "Texto");

            var categoriasUsuario = BasePage.CategoriasUsuario.ObtenerTodos();
            this.selUserGrid_Search_UsuarioCategoria.Bind(categoriasUsuario, "Id", "Texto");
        }

        #endregion
    }
}
